package io.rehuo.modules.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.rehuo.modules.app.dao.AddressDao;
import io.rehuo.modules.app.entity.AddressEntity;
import io.rehuo.modules.app.service.AddressService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shiguang
 * @date 2022年09月17日 23:47
 */
@Service("addressService")
public class AddressServiceImpl extends ServiceImpl<AddressDao, AddressEntity> implements AddressService {

    @Override
    public List<AddressEntity> getList(Long parentId) {
        return baseMapper.selectList(new QueryWrapper<AddressEntity>()
                .eq(parentId != null,"parent_id",parentId)
                .eq(parentId == null , "parent_id",0).orderByAsc("code"));
    }
}
